class: center, middle, inverse, title-slide # What is leaflet? --- layout: true <div class="dk-footer"> <span> <a href="https://rfortherestofus.com/" target="_blank">R for the Rest of Us </a> </span> </div> --- class: center, middle, dk-section-title background-image:url("https://images.pexels.com/photos/5428836/pexels-photo-5428836.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260") background-size: cover # What is leaflet? --- # {leaflet} and interactive maps The {leaflet} package allows you to create interactive maps. These interactive maps can be created in all of these places: - RMarkdown reports - RMarkdown slides - {shiny} apps ---
--- # How is this possible? .pull-left[ {htmlwidgets} is a tool for R developers to build R packages that allow us to make *interactive things*. ] .pull-right[ <img src='images/htmlwidgets-org.png'/> ] --- # How is this possible? .pull-left[ {htmlwidgets} is a tool for R developers to build R packages that allow us to make *interactive things*. It works by wrapping JavaScript packages. ] .pull-right[ <img src='images/htmlwidgets-org.png'/> ] --- ## ... JavaScript? 1. JavaScript is the scripting language of the interactive web (often called JS). -- 2. Almost every interactive table, chart and map you'll find in a website is built with JavaScript. -- 3. Just like with R there are different JavaScript packages for doing different things - leaflet for interactive maps - plotly and highcharts for interactive charts - datatables and reactable for interactive tables --- # htmlwidgets.org .pull-left[ {htmlwidgets} is a tool for R developers to build R packages wrap JavaScript packages. Each {htmlwidget} package wraps a different JavaScript package. We can then write R code to make interactive things. ] .pull-right[ <img src='images/htmlwidgets-org.png'/> ] --- ## Do I need to learn JavaScript? Most interactive maps you'll want to make with `{leaflet}` **won't require learning any JavaScript**. But. ... you will need to learn a little bit of HTML and potentially CSS.